package com.xian.im.web.modules.sys;

import com.alibaba.nacos.api.naming.pojo.Instance;
import com.xian.im.common.result.RestResult;
import com.xian.im.common.result.RestResultBuilder;
import com.xian.im.modules.distributed.ContextInstance;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: xian-im-server
 * @description:
 * @author: liru.xian
 * @create: 2021-02-03 10:21
 **/
@RestController
@RequestMapping("im/test")
@Api(value = "调度器", tags = {"调度器"})
public class SystemInstanceController {

    @Autowired
    private ContextInstance contextInstance;


    @ApiOperation(value = "获取调度实例", notes = "获取调度实例")
    @RequestMapping(value = "/{mark}",method = RequestMethod.GET)
    public RestResult<Instance> clear(@PathVariable("mark") String mark){
        Instance server = contextInstance.getServer(mark);
        return RestResultBuilder.builder().success(server).build();
    }

}
